package shujia.day15;

/*
    礼让线程: 让线程之间看起来更加和谐
 */
class MyThread5 extends Thread{
    public MyThread5() {
    }

    public MyThread5(String name) {
        super(name);
    }

    @Override
    public void run() {
        for(int i=1;i<=200;i++){
            System.out.println(getName()+" - "+i);
            Thread.yield();
        }
    }
}
public class ThreadYieldDemo1 {
    public static void main(String[] args) {
        MyThread4 t1 = new MyThread4("张成阳");
        MyThread4 t2 = new MyThread4("方直");
        MyThread4 t3 = new MyThread4("杨浩东");

        t1.start();
        t2.start();
        t3.start();
    }
}
